/******************************************************文本框*****************************************************/
_$.ButtonAuth=function (target){
    var _this = this;
    _$.ButtonAuth.superclass.constructor.call(_this,target);
};
_$.regClass("ButtonAuth",_$.ButtonAuth);

_$.extend(_$.ButtonAuth,_$.Component, {
    _cls:_$._clsPre + "ButtonAuth",
    _uiCls:_$._uiPreCls + "ButtonAuth",
    _attrProps:function(){
        var _this = this;
        var properties = _$.ButtonAuth.superclass._attrProps.call(_this);
        properties.addAll(["clazz","press","iconCls","buttonText","onclick"]);
        return properties;
    },
    _attrOpts:function(){
        var _this = this;
        var opts = _$.ButtonAuth.superclass._attrOpts.call(_this);
        return $.extend(true,opts,{
            "clazz":"btn btn-default",
            "iconCls":"",
            "press":""
        });
    },
    _create:function(){
        var _this = this;
        var clazz = _this.getOption("clazz");
        var iconCls = _this.getOption("iconCls");
        var buttonText = _this.getOption("buttonText");
        var onclick = _this.getOption("onclick");

        var source='<button type="button" class="'+clazz+'" onclick="'+onclick+'"><span class="glyphicon '+iconCls+'"></span>'+buttonText+'</button>';

        _this._replaceNode(source);
        _this.component = _this.el;
        _this.el.addClass(_this._uiCls);
        _this._setStyle();
        _this._init();
        _this._bindEvents();
    },
    _init:function(){
        var _this = this;
        var flag = _this._hasAuth();
        if(!flag){
            _this.component.hide();
        }
        _this._loadSuccess();
    },
    _hasAuth:function(){
        var _this = this;
        var press =_this.getOption("press");
        if(isEmpty(press)){
            return true;
        }

        if(isEmpty(authorityes) || authorityes.length == 0){
            return false;
        }

        for(var i=0;i<authorityes.length;i++){
            var item = authorityes[i];
            var code = item["code"];

            if(code == press){
                return true;
            }
        }
      return false;
    },
    _bindEvents:function(){

    }
});
